Arithmetic operators

Flash operators follow basic mathematical principles. Multiplication and division occur before addition and subtraction. Terms within parentheses occur before multiplication and division. Attempting division by zero results in the string #ERROR#.

These are some examples of arithmetic expressions:

(1+2)*3
Principal*Rate*Time
Subtotal*(1+(SalesTaxRate/100))
-Value (negative value of variable Value)
+Value (leaves value unchanged)

You can use the functions Int() and Length() in arithmetic expressions because these functions return numbers.

Int(number) returns the integer value of a specific number. For example, INT(12.5) returns 12.

Length(string) returns the length of the specified string. For example, Length("Hello") returns 5.

Length(variableName) returns the length of variable name. For example, Random (5) returns 0, 1, 2, 3, or 4.

If you use a string in a Flash expression, the string is converted to numbers when used with numerical operators. For example, "1"+2 evaluates to 3.

If the string cannot be converted to a number, the string evaluates to 0. For example, in the expression "ABC"+3, ABC evaluates to 0. The result is 0+3, which is 3.